<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="utf-8">
		<title>主页</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="/resource/layui/css/layui.css">
		<link rel="stylesheet" href="/resource/css/global.css">
		<link rel="stylesheet" href="/resource/css/common.css">
	</head>
	<body>
		<!--导航栏由此开始-->
		<div class="fly-header layui-bg-green">
			<div class="layui-container">
				<a class="fly-logo" href="/user/redirectIndex.do">
					<div class="layui-logo" style="font-size: 20px; color: #CAE1FF;"><span class="iconfont-ali icon-B" style="font-size: 35px"></span></div>
				</a>
				 <ul class="layui-nav fly-nav layui-hide-xs">
			      <li class="layui-nav-item layui-this">
			        <a href="/user/redirectIndex.do"><i class="layui-icon  layui-icon-home"></i>首页</a>
			      </li>
    			</ul>
				<ul class="layui-nav fly-nav-user">
					<!-- 未登入的状态 -->
					<li class="layui-nav-item">
						<a class="iconfont-ali  icon-yonghu layui-hide-xs" href="/login.html"></a>
					</li>
					<li class="layui-nav-item">
						<a href="/login.html">登入</a>
					</li>
					<li class="layui-nav-item">
						<a href="/register.html">注册</a>
					</li>
				</ul>
			</div>
		</div>
		<!--导航栏到此结束-->
		<div class="fly-panel fly-column">
			<div class="layui-container">
				<div class="fly-column-right layui-hide-xs">
					<span id="Bsearch" class="fly-search"><i class="layui-icon layui-icon-search"></i></span>
				</div>
			</div>
		</div>

		<div class="layui-container">
			<div class="layui-row layui-col-space15">
				<div class="layui-col-md8">
					<div class="fly-panel" style="margin-bottom: 0;">
						<div class="fly-panel-title fly-filter">
							<a href="/essay/essayreadselect.do?category=ALL&orderby=${orderby}&currentPage=1" <c:if test="${currentcategory=='ALL' }">class="layui-this"</c:if>>综合</a>
							<span class="fly-mid"></span>
							<a href="/essay/essayreadselect.do?category=commonEssay&orderby=${orderby}&currentPage=1" <c:if test="${currentcategory=='commonEssay' }">class="layui-this"</c:if>>普通帖</a>
							<span class="fly-mid"></span>
							<a href="/essay/essayreadselect.do?category=downLoadEssay&orderby=${orderby}&currentPage=1" <c:if test="${currentcategory=='downLoadEssay' }">class="layui-this"</c:if>>下载帖</a>
							<span class="fly-filter-right layui-hide-xs">
								<a href="/essay/essayreadselect.do?category=${currentcategory}&orderby=date&currentPage=1" <c:if test="${orderby=='date'}">class="layui-this"</c:if>>按最新</a>
								<span class="fly-mid"></span>
								<a href="/essay/essayreadselect.do?category=${currentcategory}&orderby=praise&currentPage=1" <c:if test="${orderby=='praise'}">class="layui-this"</c:if>>按点赞量</a>
							</span>
						</div>

						<!-- 文章由此循环 -->
						<c:if test="${!empty   essaylist }">
 						<c:forEach items="${essaylist }" var="essay">
						<ul class="fly-list">
							<li>
								<a href="/user/userhome.do" class="fly-avatar">
									<img <c:if test="${!empty essay.user.headSculpture }">src="${essay.user.headSculpture }"</c:if><c:if test="${empty essay.user.headSculpture }">src="/resource/img/logo.JPG"</c:if> alt="${essay.user.userName}">
								</a>
								<h2>
									<a class="layui-badge">${essay.label }</a>
									<a href="/essay/essaydetail.do?essayId=${essay.essayId }">${essay.title }</a>
								</h2>
								<div class="fly-list-info">
									<div >
										<span class="layui-badge layui-bg-red" id="otheruserName">${essay.user.userName }</span>
										<span class="layui-badge layui-bg-green layui-hide-xs">${essay.publishDate }</span>
									</div>
								</div>
								<div class="fly-list-badge">
									<span id="praise" class="layui-icon layui-icon-praise" title="赞">${essay.likeNumber }</span>
									<span class="fly-mid"></span>
									<span id="tread" class="layui-icon layui-icon-tread" title="踩">${essay.treadNumber }</span>
									<span class="fly-mid"></span>
									<span id="comment" class="iconfont-ali icon-pinglun" title="评论">${essay.commentNumber }</span>
									<span class="fly-mid"></span>
									<span id="validity" class="iconfont-ali icon-dengji-" title="真实度">${essay.validity }%</span>
								</div>
							</li>
						</ul>
						</c:forEach >
						</c:if>
						<!-- 文章到此循环结束 -->
						<div style="text-align: center">
							<div id="B_Page" >
							</div>
						</div>
						<c:if test="${empty essaylist }">
							 <div class="fly-none">没有相关数据</div>
						</c:if>

					</div>
				</div>
				<div class="layui-col-md4">
					<dl class="fly-panel fly-list-one">
						<dt class="fly-panel-title">本周热议</dt>
						<c:if test="${!empty   commentlist }">
						<c:forEach items="${commentlist }" var="commentlist"> 
						<dd>
							<a href="/essay/essaydetail.do?essayId=${commentlist.essayId }">${commentlist.title }</a>
							<span><i class="iconfont icon-pinglun1"></i> ${commentlist.commentNumber }</span>
						</dd>
						</c:forEach>
						</c:if>
						<!-- 无数据时 -->
						<c:if test="${empty commentlist }">
							 <div class="fly-none">没有相关数据</div>
						</c:if>
					</dl>
					</div>
				</div>
			</div>
		</div>
		<input class="layui-hide" id="page" value="${currentPage}"></input>
		<input class="layui-hide" id="category" value="${currentcategory}"></input>
		<input class="layui-hide" id="orderby" value="${orderby}"></input>
		<input class="layui-hide" id="TotalNumber" value="${essayListCount}"></input>
		<div class="fly-footer">
				<p>Believe 社区 2019 &copy; 千夜 出品</p>
		</div>
		<script type="text/javascript" src="/resource/js/common.js"></script>
		<script src="/resource/js/jquery.min.js"></script>
		<script src="/resource/layui/layui.js"></script>
		<script src="/resource/js/unlogindex.js"></script>
	</body>
</html>